package com.zhl.microservcie.controller;

import com.zhl.microservcie.config.JDBCConfig;
import com.zhl.microservcie.pojo.Item;
import com.zhl.microservcie.servcie.ItemServcie;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.ws.rs.GET;

/**
 * @program: microservcie-parent
 * @author: zhl
 * @create: 2019-03-04
 **/
@RestController
public class ItemController {

    @Autowired
    private ItemServcie itemServcie;

    @Autowired
    private JDBCConfig jdbcConfig;

    @GetMapping("item/{id}")
    public Item queryItemById(@PathVariable("id")Long id){
        return itemServcie.queryItemById(id);
    }

    @GetMapping("test")
    public String test(){
        return jdbcConfig.toString();
    }
}
